<?php
//+---------------------------------------------------------------------------------------------------------------------
//| 人生是荒芜的旅行，冷暖自知，苦乐在心
//+---------------------------------------------------------------------------------------------------------------------
//| Author:Janmas <janmas@126.com>
//+---------------------------------------------------------------------------------------------------------------------
//| 
//+---------------------------------------------------------------------------------------------------------------------


namespace app\plugins\goods\admin\model;


use app\common\plugins\PluginModel;
use think\model\concern\SoftDelete;

class Goods extends PluginModel
{
    use SoftDelete;

    protected $autoWriteTimestamp = true;

    protected $createTime = 'createtime';

    protected $updateTime = 'updatetime';

    protected $deleteTime = 'deletetime';

    protected $defaultSoftDelete = null;

    protected $schema = [
        'id' => 'int',
        //商品名
        'name' => 'string',
        //缩略图
        'thumb' => 'int',
        //轮播图
        'images' => 'string',
        //状态
        'status' => 'int',
        //售价
        'price' => 'int',
        //原价
        'origin_price' => 'int',
        //成本价
        'cost_price' => 'int',
        //单位
        'unit' => 'string',
        //
        'desc' => 'string',
        //内容
        'detail' => 'string',
        //库存,
        'stock' => 'int',
        //虚拟销量
        'virtual_sales' => 'int',
        //销量
        'sales' => 'int',
        //重量
        'weigh' => 'int',
        //商品类型 0商品 1虚拟商品
        'type' => 'int',
        //视频
        'video' => 'string',
        //是否开启规格
        'use_attr' => 'int',
        //排序
        'sort' => 'int',
        //起购数量
        'min_buy_number' => 'int',
        //限购
        'max_buy_number' => 'int',
        //赠送积分
        'give_integral' => 'int',
        //赠送积分类型 0固定值|1百分比
        'give_integral_type' => 'int',
        //赠送余额
        'give_balance' => 'int',
        //赠送余额类型 0固定值|1百分比
        'give_balance_type' => 'int',
        //可抵扣积分
        'forehead_integral' => 'int',
        //可抵扣积分类型 0固定值|1百分比
        'forehead_integral_type' => 'int',
        //自定义分销缩略
        'share_pic' => 'int',
        //自定义分享标题
        'share_title' => 'string',
        //自定义分享内容
        'share_desc' => 'string',
        //商品标识 //默认空
        'sign' => 'string',
        //模板id
        'freight_id' => 'int',
        'createtime' => 'int',
        'updatetime' => 'int',
        'deletetime' => 'int',
    ];

    public function attrs(){
        return $this->hasMany(GoodsAttr::class,'goods_id','id');
    }
}